import JSEncrypt from 'jsencrypt/bin/jsencrypt.min'

const publicKey = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvMboUQ59Q0KTzF7BIDN+NdiHBEE1tlnGl7/27H7Im8n1JKdbbaZPV7jiYxaoZJjdTxMoh7ee0oX+tqXf6tD0lG9v9tl6V0d9f4TrrCVWwz7l20eSCQDOgNfIBBf+k4nkzbYkeBU5MdBnO4HG3oH3xVL0NPJ6zDKYua5sXu6Gr5wIDAQAB'

//公钥加密 登录用 私钥保存在后台代码中不进行暴露
export function rsaEncryptPublic(txt) {
  const encryptor = new JSEncrypt()
  encryptor.setPublicKey(publicKey) // 设置公钥
  return encryptor.encrypt(txt) // 对数据进行加密
}
